class Solution:
    def minMovesToCaptureTheQueen(self, a: int, b: int, c: int, d: int, e: int, f: int) -> int:
        # Location of Rook is (a, b)
        # Location of Bishop is (c, d)
        # Location of Queen is (e, f)
        if a == e and (a != c or d >= max(b, f) or d <= min(b, f)):
            # 车和皇后在同一行，象不在该行或在外
            return 1
        if b == f and (b != d or c >= max(a, e) or c <= min(a, e)):
            # 车和皇后在同一列，象不在该列或在外
            return 1
        if (abs(c - e) == abs(d - f)) and ((c - e) * (b - f) != (a - e) * (d - f) or a < min(c, e) or a > max(c, e)):
            # 通过斜率计算，点是否在同一个斜线上
            return 1
        return 2

if __name__ == "main()":
    s = Solution()
    s.minMovesToCaptureTheQueen(a = 1, b = 1, c = 8, d = 8, e = 2, f = 3)
    s.minMovesToCaptureTheQueen(a = 5, b = 3, c = 3, d = 4, e = 5, f = 2)
    s.minMovesToCaptureTheQueen(a = 4, b = 3, c = 3, d = 4, e = 2, f = 5)
    s.minMovesToCaptureTheQueen(8, 4, 8, 8, 7, 7)
    s.minMovesToCaptureTheQueen(1, 1, 1, 4, 1, 8)
    